package org.lanqiao.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.taglibs.standard.lang.jstl.test.beans.Factory;
import org.lanqiao.bean.EduTeacherBean;
import org.lanqiao.myUtils.Myutils;
import org.lanqiao.service.FactoryService;

public class TeacherMoSelfSevelet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// 修改老师自己的信息
		//实例化
		EduTeacherBean etb = (EduTeacherBean) Myutils.getNewInstance(EduTeacherBean.class);
		etb.setTeacherid(Myutils.getInteger(request.getParameter("userId")));
		etb.setTeacherpassword(request.getParameter("userPassword"));
		// 存名字
		etb.setTeachername(request.getParameter("userName"));
		// 存性別
		etb.setTeachersex(request.getParameter("userSex"));
		// 存年龄段
		etb.setTeacherage(Myutils.getInteger(request.getParameter("userAge")));

		// 存电话
		etb.setTeachertel(request.getParameter("userTel"));
		// 存地址
		etb.setTeacherdress(request.getParameter("userAddress"));
		
		EduTeacherBean etbb=FactoryService.getUserInfoManageService().getTeacherSelf(etb);
		
		request.getSession().setAttribute("TeacherBean", etbb);
		
		request.getRequestDispatcher("logined/TeaLoginedInfo/teaSelfInfo.jsp").forward(request, response);
		
	}
	
	

}
